﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using WITS.Framework.Interface;
using WITS.Framework.Builder.Public;
using WITS.Framework.Common;

namespace WITS.Framework.Builder.ExceptionProcess
{
    public class ToolsExceptionProcess : IExceptionProcess
    {
        #region IExceptionProcess Members

        public void DoProcess(Exception ex)
        {
            string errorcode = "ERC" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
            GlobalCommon.ErrorMsg += "\r\n錯誤編號:" + errorcode + "\r錯誤信息描述：" + (ex.InnerException != null ? ex.InnerException.Message + "\r\n" : "") + ex.Message;
            GlobalCommon.ErrorMsg += "\r" + ex.StackTrace;
            GlobalCommon.Logger.WriteLog(LoggerLevel.ERROR, "錯誤編號:" + errorcode + "\r\n錯誤信息描述：" + ex.Message + "\r\n" + ex.StackTrace);
            HttpContext.Current.Response.Redirect("~/Error.aspx", false);
        }

        #endregion
    }
}
